package main

import (
	"filestore/handler"
	"fmt"
	"net/http"
)

func main() {
	//文件上传 [post】
	http.HandleFunc("/file/upload", handler.UploadHandler)
	http.HandleFunc("/file/upload/suc", handler.UploadSucHandler)

	//查看文件元信息
	// localhost:8085/file/meta?filehash=afd8d8dcb5c5dbe49aa3e5a9d8e525568476f915
	http.HandleFunc("/file/meta", handler.GetFileMetaHandler)

	//下载文件
	http.HandleFunc("/file/download", handler.DownloadHandler)

	//更新文件元信息
	http.HandleFunc("/file/update", handler.FileMetaUpdateHandler)

	//删除文件
	http.HandleFunc("/file/delete", handler.FileDeleteHandler)

	//用户注册
	http.HandleFunc("/user/signup", handler.SignupHandler)

	//用户登录
	http.HandleFunc("/user/signin", handler.SignInHandler)

	// 监听
	err := http.ListenAndServe(":8086", nil)
	if err != nil {
		fmt.Printf("Failed to start, err:%s", err.Error())
	}

}
